package com.cn.wanxi.service.impl;

import com.cn.wanxi.dao.ProductDao;
import com.cn.wanxi.dao.impl.ProductImpl;
import com.cn.wanxi.model.ProductModel;
import com.cn.wanxi.service.ProductService;

import java.util.List;

public class ProductServiceImpl implements ProductService {
    @Override
    public List<ProductModel> findAll(ProductModel productModel) {
        ProductDao productDao = new ProductImpl();
        return productDao.findAll(productModel);
    }

    @Override
    public int getCount(ProductModel productModel) {
        ProductDao productDao = new ProductImpl();
        return productDao.getCount(productModel);
    }

    @Override
    public String add(ProductModel productModel) {
        ProductDao productDao = new ProductImpl();
        return productDao.add(productModel) > 0 ? "success" : "error";
    }

    @Override
    public List<ProductModel> findProductForHome() {
        ProductDao productDao = new ProductImpl();
        return productDao.findProductForHome();
    }
}
